/*
 *******************************************************************
 *@date:	2013/05/26
 *@file:	ReaderWriterFbx
 *@author:	kushinn
 *@email:   lf.kushinn@gmail.com
 *@promise: 
 *@purpose:	
 *******************************************************************
 */
#ifndef __READER_WRITER_FBX_H
#define __READER_WRITER_FBX_H
#include "ReaderWriter.h"
/***************************************************
 * reader plugin for the ".fbx" format.
 * See http://www.autodesk.com/fbx
 * This plugin requires the FBX SDK version 2013.3
 */
#include "fbxsdk.h"
#if FBXSDK_VERSION_MAJOR != 2013 || FBXSDK_VERSION_MINOR < 3
#error Wrong FBX SDK Version
#endif

namespace Nezha
{
	namespace stream
	{
		class IReadFile;
	}
	class ReaderWriterFbx : public ReaderWriter
	{
	public:
		class Delegate
		{
		public:
			Delegate(FbxManager* fbxMgr) { mFbxMgr = fbxMgr; }
			~Delegate() { mFbxMgr->Destroy(); }
		private:
			FbxManager* mFbxMgr;
		};

	public:
		ReaderWriterFbx();
		virtual Result& readFile(const std::string& filename, const Options* support);
		virtual Result& writeFile(const std::string& filename, const Options* support);

	private:
		static bool loadFile(const std::string& filename, Result& result, FbxScene* scene);
		static bool import(const std::string &filename, Result &result, FbxScene* scene);
		static bool checkFile(const std::string &filename, Result &result);
	private:
		bool convertScene();
	private:
		FbxScene* mScene;
		Result mResult;
	};
}

#endif